import {CSSProperties, memo, MouseEventHandler} from 'react';
import type { FC, PropsWithChildren } from 'react';
import { ICONFONT_CN_SRC } from '@/constants/api';
import { createFromIconfontCN } from '@ant-design/icons';
import './index.scss';

const AppIcon: FC<
  PropsWithChildren<{ icon: string; className?: string; onClick?: MouseEventHandler ; style?: CSSProperties }>
> = ({ icon, className,onClick, style }) => {
  const IconFont = createFromIconfontCN({
    scriptUrl: ICONFONT_CN_SRC,
  });
  return <IconFont onClick={onClick} type={icon} className={className} style={style} />;
};

export default memo(AppIcon);
